import QtQuick 2.0
import QtQuick.Controls 2.12

import XUI 1.0

Button {
    id: root

    property color  _themeC :           XGlobalColor.theme
    property color _backgroundColor:    "#88000000" //矩形背景颜色
    property color _borderColor :   _themeC      // 边框颜色
    property color _fontColor      // 字体颜色
    property bool   _small :      false

    property var source

    height:      contentItem.implicitHeight  + XScreenTool.base * 2
    width:       contentItem.implicitWidth  + XScreenTool.base * 3

    contentItem: Item {
        id:      itemControl
        XColoredImage {
            anchors.centerIn:                   parent
            height:                             parent.height * 0.5
            width:                              height
            source:                             root.source
            color:                              root.enabled ? "white"  :  "grey" //root.enabled ? GlobalColor.theme : "#337f8f8f"//"#4480f0f0" // : "#4480f0f0"//GlobalColor.lighterTheme
        }
    }

    background: Rectangle   {
        id:                 buttonBkRect
        radius:             height/2
        color:              "#88000000" //root.enabled ? "#88000000" : "#22000000"//"transparent"
        anchors.fill:       parent
        border.color:       _borderColor
        border.width:       2
    }

    state:                             "Default"
    states: [
        State {
            name:                       "Default"
            PropertyChanges {
                target: root;
                // _borderColor:                  pressed ?   "#3E4F59" :  "#678F74"//"#449698"
                // _backgroundColor:             pressed ?   "#3E4F59":  "#678F74"// "#449698")  //sgButton
                // _fontColor:                   (pressed ?   "white":   "white")  //sgButton
            }
        }
    ]
}
